package com.scm.java.net.basic.service;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.scm.entity.base.Supplier;
import com.scm.java.net.dao.CommonDao;

public class SupplierServiceImpl implements SupplierService {

	private CommonDao dao;

	@Override
	public void addSupplier(Supplier supplier) throws SQLException {

		// ID转大写
		supplier.setSupplierId(supplier.getSupplierId().toUpperCase());
		dao.addObj("supplier.addSupplier", supplier);
	}

	@Override
	public List getSupplier(Supplier supplier) throws SQLException {
		Map<String, Object> paraMap = new HashMap<String, Object>();
		paraMap.put("supplier", supplier);
		return dao.queryList("supplier.getSupplier", paraMap);
	}

	@Override
	public void editSupplier(Supplier supplier) throws SQLException {
		dao.editObj("supplier.editSupplier", supplier);
	}

	@Override
	public void delSupplier(Supplier supplier) throws SQLException {
		dao.del("supplier.del", supplier);

	}

	public void setDao(CommonDao dao) {
		this.dao = dao;
	}

}
